﻿<%@ Page Language="C#" CodeBehind="Gallery.aspx.cs" Inherits="d3PrtDgn.Web.User.Gallery"
	MasterPageFile="~/Web/d3PrtDgnTemplate.Master" %>

<asp:Content ID="body" ContentPlaceHolderID="body" runat="server">
	<script type="text/javascript">
		function confirmDeleteAlbum()
		{
			return confirm('<%= GetMessage("reallyDeleteAlbum") %>')		
		}
		function confirmDeletePhoto()
		{
			return confirm('<%= GetMessage("reallyDeletePhoto") %>')		
		}
	</script>
	<h2><%= GetMessage("mainHeader") %></h2>
	<h3><%= GetMessage("galleriesHeader") %></h3>
	<asp:Table runat="server">
		<asp:TableRow>
			<asp:TableCell>
				<asp:Table runat="server">
					<asp:TableRow>
						<asp:TableHeaderCell class="leftHeader">
							<asp:Label runat="server" ID="lblCategory" /></asp:TableHeaderCell>
						<asp:TableCell>
							<asp:DropDownList runat="server" ID="ddlCategory" />
						</asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableHeaderCell class="leftHeader">
							<asp:Label runat="server" ID="lblVisibility" /></asp:TableHeaderCell>
						<asp:TableCell>
							<asp:DropDownList runat="server" ID="ddlVisibility" />
						</asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableHeaderCell class="leftHeader">
							<asp:Label runat="server" ID="lblName" /></asp:TableHeaderCell>
						<asp:TableCell>
							<asp:TextBox runat="server" ID="tbName" /></asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableHeaderCell class="leftHeader">
							<asp:Label runat="server" ID="lblAbbreviation" /></asp:TableHeaderCell>
						<asp:TableCell>
							<asp:TextBox runat="server" ID="tbAbbreviation" Enabled="false" /></asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableHeaderCell class="leftHeader">
							<asp:Label runat="server" ID="lblDescription" /></asp:TableHeaderCell>
						<asp:TableCell>
							<asp:TextBox runat="server" ID="tbDescription" /></asp:TableCell>
					</asp:TableRow>
					<asp:TableRow>
						<asp:TableCell ColumnSpan="2">
							<asp:Button runat="server" ID="btnSave" OnClick="Save" />
							<asp:Button runat="server" ID="btnCancel" OnClick="Cancel" />
						</asp:TableCell>
					</asp:TableRow>
				</asp:Table>
			</asp:TableCell>
			<asp:TableCell>
				<asp:GridView runat="server" ID="gvAlbums" AllowSorting="true" DataKeyNames="Id"
					AutoGenerateColumns="false" OnSelectedIndexChanging="EditAlbum" OnRowDeleting="DeleteAlbum">
					<Columns>
						<asp:TemplateField SortExpression="Category">
							<HeaderTemplate>
								<%= GetMessage("$this.lblCategory.Text")%></HeaderTemplate>
							<ItemTemplate>
								<%# Eval("Category.Name")%></ItemTemplate>
						</asp:TemplateField>
						<asp:TemplateField SortExpression="Name">
							<HeaderTemplate>
								<%= GetMessage("$this.lblName.Text")%></HeaderTemplate>
							<ItemTemplate>
								<%# Eval("Name")%></ItemTemplate>
						</asp:TemplateField>
						<asp:TemplateField SortExpression="Visibility">
							<HeaderTemplate>
								<%= GetMessage("$this.lblVisibility.Text")%></HeaderTemplate>
							<ItemTemplate>
								<%# Eval("Visibility")%></ItemTemplate>
						</asp:TemplateField>
						<asp:TemplateField SortExpression="Created">
							<HeaderTemplate>
								<%= GetMessage("created")%></HeaderTemplate>
							<ItemTemplate>
								<%# Eval("Created")%></ItemTemplate>
						</asp:TemplateField>
						<asp:TemplateField>
							<ItemTemplate>
								<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("Id") %>' CommandName="Select"
									runat="server">
									<%= GetMessage("edit") %>
								</asp:LinkButton>
								<asp:LinkButton ID="LinkButton2" CommandArgument='<%# Eval("Id") %>' CommandName="Delete"
									runat="server" OnClientClick="return confirmDeleteAlbum();">
									<%= GetMessage("delete") %>
								</asp:LinkButton>
							</ItemTemplate>
						</asp:TemplateField>
					</Columns>
				</asp:GridView>
			</asp:TableCell>
		</asp:TableRow>
	</asp:Table>

	<asp:Panel runat="server" ID="pnlPhotos">
		<br /><br />
		<h3><%= GetMessage("photosHeader") %></h3>
		<asp:Table runat="server">
			<asp:TableRow>
				<asp:TableHeaderCell CssClass="leftHeader">
					<asp:Label runat="server" ID="lblPhotoFile" /></asp:TableHeaderCell>
				<asp:TableCell>
					<asp:FileUpload runat="server" ID="fuPhoto" /></asp:TableCell>
			</asp:TableRow>
			<asp:TableRow>
				<asp:TableHeaderCell class="leftHeader">
					<asp:Label runat="server" ID="lblPhotoName" /></asp:TableHeaderCell>
				<asp:TableCell>
					<asp:TextBox runat="server" ID="tbPhotoName" /></asp:TableCell>
			</asp:TableRow>
			<asp:TableRow>
				<asp:TableHeaderCell class="leftHeader">
					<asp:Label runat="server" ID="lblPhotoAbbreviation" /></asp:TableHeaderCell>
				<asp:TableCell>
					<asp:TextBox runat="server" ID="tbPhotoAbbreviation" Enabled="false" /></asp:TableCell>
			</asp:TableRow>
			<asp:TableRow>
				<asp:TableHeaderCell class="leftHeader">
					<asp:Label runat="server" ID="lblPhotoDescription" /></asp:TableHeaderCell>
				<asp:TableCell>
					<asp:TextBox runat="server" ID="tbPhotoDescription" /></asp:TableCell>
			</asp:TableRow>
			<asp:TableRow>
				<asp:TableCell ColumnSpan="2">
					<asp:Button runat="server" ID="btnSavePhoto" OnClick="SavePhoto" />
					<asp:Button runat="server" ID="btnCancelPhoto" OnClick="CancelPhoto" />
				</asp:TableCell>
			</asp:TableRow>
		</asp:Table>
		<asp:Repeater runat="server" ID="repPhotos">
			<ItemTemplate>
				<div class="photoAdmin">
					<span class="header"><%# DataBinder.Eval(Container.DataItem, "Name") %></span><br />
					<img src='/Photos/Thumb/user<%# DataBinder.Eval(SignedInUser, "Id") %>/<%# DataBinder.Eval(Container.DataItem, "Filename") %>' />
					<div>
						<asp:LinkButton ID="LinkButton1" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id") %>' CommandName="Select" runat="server" OnClick="EditPhoto">
							<%= GetMessage("edit") %>
						</asp:LinkButton>
						<asp:LinkButton ID="LinkButton2" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id") %>' CommandName="Delete" runat="server" OnClick="DeletePhoto" OnClientClick="return confirmDeletePhoto();">
							<%= GetMessage("delete") %>
						</asp:LinkButton>
					</div>
				</div>
			</ItemTemplate>
		</asp:Repeater>
	</asp:Panel>
	<div class="cleaner">&#160;</div>
</asp:Content>
